%li.todo.gl-hover-border-blue-200.gl-hover-bg-blue-50.gl-hover-cursor-pointer.gl-relative{ class: "todo-#{todo.done? ? 'done' : 'pending'}", id: dom_id(todo) }
  .gl-display-flex.gl-flex-direction-column.gl-sm-flex-direction-row.gl-sm-align-items-center
    .todo-item.gl-overflow-hidden.gl-overflow-x-auto.gl-align-self-center.gl-w-full{ data: { qa_selector: "todo_item_container" } }
      .todo-title.gl-pt-2.gl-pb-3.gl-px-2.gl-md-mb-1.gl-font-sm.gl-text-secondary

        = todo_target_state_pill(todo)

        %span.todo-target-title{ data: { qa_selector: "todo_target_title_content" }, :id => dom_id(todo) + "_describer" }
          = todo_target_title(todo)

          - if !todo.for_design? && !todo.member_access_requested?
            &middot;

        %span
          = todo_parent_path(todo)

        %span.todo-label
          - if todo.target
            = link_to todo_target_name(todo), todo_target_path(todo), class: 'todo-target-link gl-text-secondary! gl-text-decoration-none!', :'aria-describedby' => dom_id(todo) + "_describer", :'aria-label' => todo_target_aria_label(todo)
          - else
            = _("(removed)")

      .todo-body.gl-mb-2.gl-px-2.gl-display-flex.gl-align-items-flex-start.gl-lg-align-items-center
        .todo-avatar.gl-display-none.gl-sm-display-inline-block
          = author_avatar(todo, size: 24)
        .todo-note
          - if todo_author_display?(todo)
            .author-name.bold.gl-display-inline{ data: { qa_selector: "todo_author_name_content" } }<
              - if todo.author
                = link_to_author(todo, self_added: todo.self_added?)
              - else
                = _('(removed)')
              - if todo.note.present?
                \:

          %span.action-name{ data: { qa_selector: "todo_action_name_content" } }<
            - if !todo.note.present?
              = todo_action_name(todo)
              - unless todo.self_assigned?
                \.

          - if todo.self_assigned?
            %span.action-name<
              = todo_self_addressing(todo)
              \.
          - if todo.note.present?
            %span.action-description<
            = first_line_in_markdown(todo, :body, 125, is_todo: true, project: todo.project, group: todo.group)

    .todo-timestamp.gl-white-space-nowrap.gl-sm-ml-3.gl-mt-2.gl-mb-2.gl-sm-my-0.gl-px-2.gl-sm-px-0
      %span.todo-timestamp.gl-font-sm.gl-text-secondary
        = todo_due_date(todo)
        #{time_ago_with_tooltip(todo.created_at)}


    .todo-actions.gl-mr-4.gl-px-2.gl-sm-px-0.gl-sm-mx-0
      - if todo.pending?
        = render Pajamas::ButtonComponent.new(button_options: { class: 'btn-loading btn-icon gl-display-flex js-done-todo has-tooltip', title: _('Mark as done')}, method: :delete, href: dashboard_todo_path(todo)), 'aria-label' => _('Mark as done') do
          = gl_loading_icon(inline: true)
          = sprite_icon('check', css_class: 'js-todo-button-icon')
        = render Pajamas::ButtonComponent.new(button_options: { class: 'btn-loading btn-icon gl-display-flex js-undo-todo hidden has-tooltip', title: _('Undo')}, method: :patch, href: restore_dashboard_todo_path(todo)), 'aria-label' => _('Undo') do
          = gl_loading_icon(inline: true)
          = sprite_icon('redo', css_class: 'js-todo-button-icon')
      - else
        = render Pajamas::ButtonComponent.new(button_options: { class: 'btn-loading btn-icon gl-display-flex js-add-todo has-tooltip', title: _('Add a to do')}, method: :patch, href: restore_dashboard_todo_path(todo)), 'aria-label' => _('Add a to do') do
          = gl_loading_icon(inline: true)
          = sprite_icon('todo-add', css_class: 'js-todo-button-icon')
